using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Wips.Domain.Models.Authorities.Model
{
    /// <summary>
    /// 角色组
    /// </summary>
    [Table("AuthorityRoleGroups")]
    [SugarTable("AuthorityRoleGroups")]
    public class RoleGroup : EntityBase, IAggregateRoot
    {

        /// <summary>
        /// 名称
        /// </summary>
        /// <value></value>
        [Required]
        [MaxLength(32)]
        public string Name { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        /// <value></value>
        [MaxLength(500)]
        public string Remarks { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        /// <value></value>
        public Status Status { get; set; }



        /// <summary>
        /// 最后更新人Id
        /// </summary>
        public string LastUpdatedUserId { get; set; }

        /// <summary>
        /// 状态变更
        /// </summary>
        /// <param name="lastUpdatedUserId"></param>
        public void StatusChange(string lastUpdatedUserId)
        {
            Status = Status == Status.Disabled ? Status.Enabled : Status.Disabled;
            LastUpdatedUserId = lastUpdatedUserId;
            Updated = DateTime.Now;
        }
    }
}